package com.objetdirect.gwt.umldrawer.shared.dto;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table (name = "MESSAGES")
public class MessagesDto implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue
	@Column (name = "message_id", nullable = false , unique = true)
	private long messageId ;
	
	@Column (name = "message_sender_email", nullable = false)
	private String messageSenderEmail ;
	
	@Column (name = "message_topic", nullable = false, length = 50)
	private String messageTopic ;
	
	@Temporal (TemporalType.DATE)
	@Column (name = "message_date", nullable = false)
	private Date messageDate ;
	
	@Temporal (TemporalType.TIME)
	@Column (name = "message_time", nullable = false)
	private Date messageTime ;
	
	@Column (name = "message_body", nullable = false, length = 500)
	private String messageBody ;
	
	@Column (name = "message_is_read", nullable = false)
	private int messageIsRead ;

//	@ManyToOne (fetch = FetchType.LAZY, cascade = CascadeType.REMOVE, targetEntity = DeveloperDTO.class)
//	@JoinColumn (name = "message_recieverEmail_email")
//	private DeveloperDTO recieverEmail;
	
	public MessagesDto() {
	}
	
	public MessagesDto(long messageId) {
		this.messageId = messageId ;
	}
	
//	public MessagesDTO(String messageSenderEmail, String messageTopic,
//			Date messageDate, Date messageTime, String messageBody,
////			int messageIsRead, DeveloperDTO recieverEmail) {
//		super();
//		this.messageSenderEmail = messageSenderEmail;
//		this.messageTopic = messageTopic;
//		this.messageDate = messageDate;
//		this.messageTime = messageTime;
//		this.messageBody = messageBody;
//		this.messageIsRead = messageIsRead;
//		this.recieverEmail = recieverEmail;
//	}

//	public MessagesDTO(long messageId, String messageSenderEmail,
//			String messageTopic, Date messageDate, Date messageTime,
//			String messageBody, int messageIsRead, DeveloperDTO recieverEmail) {
//		super();
//		this.messageId = messageId;
//		this.messageSenderEmail = messageSenderEmail;
//		this.messageTopic = messageTopic;
//		this.messageDate = messageDate;
//		this.messageTime = messageTime;
//		this.messageBody = messageBody;
//		this.messageIsRead = messageIsRead;
//		this.recieverEmail = recieverEmail;
//	}

	public long getmessageId() {
		return messageId;
	}

	public void setmessageId(long messageId) {
		this.messageId = messageId;
	}

	public String getMessageSenderEmail() {
		return messageSenderEmail;
	}

	public void setMessageSenderEmail(String messageSenderEmail) {
		this.messageSenderEmail = messageSenderEmail;
	}

	public String getMessageTopic() {
		return messageTopic;
	}

	public void setMessageTopic(String messageTopic) {
		this.messageTopic = messageTopic;
	}

	public Date getMessageDate() {
		return messageDate;
	}

	public void setMessageDate(Date messageDate) {
		this.messageDate = messageDate;
	}

	public Date getMessageTime() {
		return messageTime;
	}

	public void setMessageTime(Date messageTime) {
		this.messageTime = messageTime;
	}

	public String getMessageBody() {
		return messageBody;
	}

	public void setMessageBody(String messageBody) {
		this.messageBody = messageBody;
	}

	public int isMessageIsRead() {
		return messageIsRead;
	}

	public void setMessageIsRead(int messageIsRead) {
		this.messageIsRead = messageIsRead;
	}
//
//	public void setrecieverEmail(DeveloperDTO recieverEmail) {
//		this.recieverEmail = recieverEmail;
//	}
//
//	public DeveloperDTO getrecieverEmail() {
//		return recieverEmail;
//	}
}
